package com.homework.zuoye1;

import java.util.ArrayList;

public class TestCar {
    public static void main(String[] args) {
        Car bmw = new Car("宝马","黑色",500000);
        Car benz = new Car("奔驰", "红色", 300000);
        Car audio = new Car("奥迪", "红色", 200000);
        ArrayList<Car> cars = new ArrayList<>();
        cars.add(bmw);
        cars.add(benz);
        cars.add(audio);
        for (int i = 0; i < cars.size(); i++) {
            Car car = cars.get(i);
            if(car.getColor() == "红色"){
            System.out.println(car.getBrand()+"-"+car.getColor()+"-"+car.getPrice());
            }
        }
    }
}
